﻿using System;
using System.Configuration;
using mojoPortal.Net;
using mojoPortal.Web;
using Resources;
using mojoPortal.Web.Framework;
using System.Collections;
using mojoPortal.Business;
using ud_gSDMS.Code_Service;
using mojoPortal.Business.WebHelpers;
using System.IO;
using Brettle.Web.NeatUpload;
using System.Collections.Generic;
using System.Web.UI.WebControls;
using System.Web.UI;
namespace ud_gSDMS.Member
{
    public partial class UpdateMember_Full : mojoBasePage
    {
        private int pageId = -1;
        private int moduleId = -1;
        private string id;
        private SiteUser _siteUser;
        protected String cacheDependencyKey;
        DBQLNS _respository=new DBQLNS();

        void Page_Load(object sender, EventArgs e)
        {
            _siteUser = SiteUtils.GetCurrentSiteUser();
            if (_siteUser == null)
            {
                WebUtils.SetupRedirect(this, SiteRoot + "/AccessDenied.aspx");
            }
            if (!Page.IsPostBack)
            {
                PopulateLabels();
                PopulateControls();
            }
        }
        private void PopulateLabels()
        {

        }
        private void PopulateControls()
        {
            leftMenuItem.CurrentSite = Request.RawUrl;

            cbo_GioiTinh.DataValueField = "ID";
            cbo_GioiTinh.DataTextField = "Name";
            cbo_GioiTinh.DataSource = _respository.GetAllGioiTinh();
            cbo_GioiTinh.DataBind();

            cbo_TinhThanh.DataValueField = "ID";
            cbo_TinhThanh.DataTextField = "Name";
            cbo_TinhThanh.DataSource = _respository.GetAllTinhThanh();
            cbo_TinhThanh.DataBind();

            cbo_HonNhan.DataValueField = "ID";
            cbo_HonNhan.DataTextField = "Name";
            cbo_HonNhan.DataSource = _respository.GetAllHonNhan();
            cbo_HonNhan.DataBind();

            cbo_ChucVuCQCaoNhatDaQua.DataValueField = "ID";
            cbo_ChucVuCQCaoNhatDaQua.DataTextField = "Name";
            cbo_ChucVuCQCaoNhatDaQua.DataSource = _respository.GetAllChucVuHienTai();
            cbo_ChucVuCQCaoNhatDaQua.DataBind();

            cbo_ChucVuCQKiemNhiem.DataValueField = "ID";
            cbo_ChucVuCQKiemNhiem.DataTextField = "Name";
            cbo_ChucVuCQKiemNhiem.DataSource = _respository.GetAllChucVuHienTai();
            cbo_ChucVuCQKiemNhiem.DataBind();

            cbo_ChucVuHienTai.DataValueField = "ID";
            cbo_ChucVuHienTai.DataTextField = "Name";
            cbo_ChucVuHienTai.DataSource = _respository.GetAllChucVuHienTai();
            cbo_ChucVuHienTai.DataBind();

            cbo_ChuyenNganhDT.DataValueField = "ID";
            cbo_ChuyenNganhDT.DataTextField = "Name";
            cbo_ChuyenNganhDT.DataSource = _respository.GetAllChuyenNganhDT();
            cbo_ChuyenNganhDT.DataBind();

            cbo_CongViecHienNay.DataValueField = "ID";
            cbo_CongViecHienNay.DataTextField = "Name";
            cbo_CongViecHienNay.DataSource = _respository.GetAllCongViecHienNay();
            cbo_CongViecHienNay.DataBind();

            cbo_DanToc.DataValueField = "ID";
            cbo_DanToc.DataTextField = "Name";
            cbo_DanToc.DataSource = _respository.GetAllDanToc();
            cbo_DanToc.DataBind();

            cbo_HinhThucDT.DataValueField = "ID";
            cbo_HinhThucDT.DataTextField = "Name";
            cbo_HinhThucDT.DataSource = _respository.GetAllHinhThucDT();
            cbo_HinhThucDT.DataBind();

            cbo_MSChucDanh.DataValueField = "ID";
            cbo_MSChucDanh.DataTextField = "TenChucDanh";
            cbo_MSChucDanh.DataSource = _respository.GetAllMSChucDanh();
            cbo_MSChucDanh.DataBind();

            cbo_NgoaiNguKhac.DataValueField = "ID";
            cbo_NgoaiNguKhac.DataTextField = "Name";
            cbo_NgoaiNguKhac.DataSource = _respository.GetAllNgoaiNgu();
            cbo_NgoaiNguKhac.DataBind();

            cbo_NgoaiNguTTNhat.DataValueField = "ID";
            cbo_NgoaiNguTTNhat.DataTextField = "Name";
            cbo_NgoaiNguTTNhat.DataSource = _respository.GetAllNgoaiNgu();
            cbo_NgoaiNguTTNhat.DataBind();

            cbo_ThuocLoaiCB.DataValueField = "ID";
            cbo_ThuocLoaiCB.DataTextField = "DienGiai";
            cbo_ThuocLoaiCB.DataSource = _respository.GetAllThuocLoaiCB();
            cbo_ThuocLoaiCB.DataBind();

            cbo_TonGiao.DataValueField = "ID";
            cbo_TonGiao.DataTextField = "name";
            cbo_TonGiao.DataSource = _respository.GetAllTonGiao();
            cbo_TonGiao.DataBind();

            cbo_TrinhDo.DataValueField = "ID";
            cbo_TrinhDo.DataTextField = "Name";
            cbo_TrinhDo.DataSource = _respository.GetAllTrinhDo();
            cbo_TrinhDo.DataBind();

            dat_NgaySinh.SelectedDate = DateTime.Now;
            dat_NgaySinh.MinDate = DateTime.Now.AddYears(-100);
            dat_NgaySinh.MaxDate = DateTime.Now.AddYears(100);
            dat_NgayCap.SelectedDate = DateTime.Now;
            dat_NgayCap.MinDate = DateTime.Now.AddYears(-100);
            dat_NgayCap.MaxDate = DateTime.Now.AddYears(100);
            dat_ChinhThuc.SelectedDate = DateTime.Now;
            dat_ChinhThuc.MinDate = DateTime.Now.AddYears(-100);
            dat_ChinhThuc.MaxDate = DateTime.Now.AddYears(100);
            dat_HuongTuNgay.SelectedDate = DateTime.Now;
            dat_HuongTuNgay.MinDate = DateTime.Now.AddYears(-100);
            dat_HuongTuNgay.MaxDate = DateTime.Now.AddYears(100);
            dat_NgayBatDauDong.SelectedDate = DateTime.Now;
            dat_NgayBatDauDong.MinDate = DateTime.Now.AddYears(-100);
            dat_NgayBatDauDong.MaxDate = DateTime.Now.AddYears(100);
            dat_NgayBoNhiem.SelectedDate = DateTime.Now;
            dat_NgayBoNhiem.MinDate = DateTime.Now.AddYears(-100);
            dat_NgayBoNhiem.MaxDate = DateTime.Now.AddYears(100);
            dat_NgayCap.SelectedDate = DateTime.Now;
            dat_NgayCap.MinDate = DateTime.Now.AddYears(-100);
            dat_NgayCap.MaxDate = DateTime.Now.AddYears(100);
            dat_NgayHD.SelectedDate = DateTime.Now;
            dat_NgayHD.MinDate = DateTime.Now.AddYears(-100);
            dat_NgayHD.MaxDate = DateTime.Now.AddYears(100);
            dat_NgayNangLanSau.SelectedDate = DateTime.Now;
            dat_NgayNangLanSau.MinDate = DateTime.Now.AddYears(-100);
            dat_NgayNangLanSau.MaxDate = DateTime.Now.AddYears(100);
            dat_NgayTuyenDung.SelectedDate = DateTime.Now;
            dat_NgayTuyenDung.MinDate = DateTime.Now.AddYears(-100);
            dat_NgayTuyenDung.MaxDate = DateTime.Now.AddYears(100);
            dat_NgayVaoDang.SelectedDate = DateTime.Now;
            dat_NgayVaoDang.MinDate = DateTime.Now.AddYears(-100);
            dat_NgayVaoDang.MaxDate = DateTime.Now.AddYears(100);
            dat_NgayVaoNganhGD.SelectedDate = DateTime.Now;
            dat_NgayVaoNganhGD.MinDate = DateTime.Now.AddYears(-100);
            dat_NgayVaoNganhGD.MaxDate = DateTime.Now.AddYears(100);
            dat_NgayVeCoQuan.SelectedDate = DateTime.Now;
            dat_NgayVeCoQuan.MinDate = DateTime.Now.AddYears(-100);
            dat_NgayVeCoQuan.MaxDate = DateTime.Now.AddYears(100);
            BindData();
        }
        public void BindData()
        {
            txtHoTen.Text = "Đinh Khắc Quyền";
            cbo_GioiTinh.SelectedIndex = 0;
            dat_NgaySinh.SelectedDate = new DateTime(1957, 2, 20, 0, 0, 0);
            cbo_HonNhan.SelectedIndex = 1;
            txtCMND.Text = "025222355";
            txtNoiCap.Text = "TP.Hồ Chí Minh";
            dat_NgayCap.SelectedDate = new DateTime(2009, 11, 9, 0, 0, 0);
            txt_NoiSinh.Text = "xã Đức Lâm, huyện Đức Thọ, tỉnh Hà Tĩnh";
            txt_QueQuanXaPhuong.Text = "Đức Lâm";
            txt_QueQuanQuanHuyen.Text = "Đức Thọ";

            cbo_TinhThanh.SelectedIndex = 2;

            txt_HoKhauThuongTru.Text = "58/1 Khu phố 1, P. Tân Thới, Q. 12, TP. Hồ Chí Minh";
            txt_NoiOHienNay.Text = "58/1 Khu phố 1, P. Tân Thới, Q. 12, TP. Hồ Chí Minh";
            txt_DienThoai.Text = "0862724197-90918368626";
            txt_Email.Text = "quyendk@uit.edu.vn";
            cbo_DanToc.SelectedIndex = 0;
            cbo_TonGiao.SelectedIndex = 5;
            txt_ThanhPhanXuatThan.Text = "Trung Nông";
            txt_DienUuTienGD.Text = "";
            dat_NgayHD.SelectedDate = new DateTime(1978, 9, 1, 0, 0, 0);
            dat_NgayTuyenDung.SelectedDate = new DateTime(1978, 9, 1, 0, 0, 0);
            txt_CoQuanTN.Text = "Đại Học Cần Thơ";
            txt_CongViec.Text = "CBGD";
            dat_NgayVeCoQuan.SelectedDate = new DateTime(2008, 1, 1, 0, 0, 0);
            cbo_ThuocLoaiCB.SelectedIndex = 0;
            cbo_CongViecHienNay.SelectedIndex = 0;
            txt_DangNghiBHXH.Text = "";
            dat_NgayVaoNganhGD.SelectedDate = new DateTime(1978, 9, 1, 0, 0, 0);
            cbo_ChucVuHienTai.SelectedIndex = 0;
            txt_HeSoPCCV.Text = "";
            dat_NgayBoNhiem.SelectedDate = new DateTime(2010, 3, 1, 0, 0, 0);
            cbo_ChucVuCQCaoNhatDaQua.SelectedIndex = 1;
            cbo_ChucVuCQKiemNhiem.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("", "0"));
            dat_NgayVaoDang.SelectedDate = new DateTime(1998, 3, 9, 0, 0, 0);
            dat_ChinhThuc.SelectedDate = new DateTime(1999, 3, 9, 0, 0, 0);
            txt_ChucVuDang.Text = "";
            chb_LaDoanVien.Checked = true;
            txt_ChucVuDoanThe.Text = "";
            txt_DangTheoHoc.Text = "";
            txt_DienUuTienBanThan.Text = "";
            txt_HocVanPhoThong.Text = "THPT";
            txt_MSTD.Text = "";
            cbo_TrinhDo.SelectedIndex = 2;
            cbo_ChuyenNganhDT.SelectedIndex = 0;
            txt_NoiDT.Text = "ĐHTH TP. HCM";
            cbo_HinhThucDT.SelectedIndex = 0;
            txt_NamTN.Text = "2006";
            txt_TDLLCT.Text = "Sơ cấp";
            txt_TDQLNN.Text = "";
            txt_TDQLGD.Text = "";
            txt_TDTinHoc.Text = "";
            cbo_NgoaiNguTTNhat.SelectedIndex = 2;
            cbo_NgoaiNguKhac.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("", "0"));
            cbo_MSChucDanh.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("", "0"));
            txt_NamCongNhan.Text = "";
            txt_DanhHieuCaoNhat.Text = "";
            txt_MaNgach.Text = "15.110";
            txt_Bac.Text = "6";
            txt_HeSo.Text = "6.10";
            dat_HuongTuNgay.SelectedDate = new DateTime(2011, 11, 1, 0, 0, 0);
            dat_NgayNangLanSau.SelectedDate = new DateTime(2011, 11, 1, 0, 0, 0);
            txt_PCUD.Text = "25%";
            txt_HSPCTN.Text = "";
            txt_HSPCTH.Text = "";
            txt_HSPCDH.Text = "";
            txt_HSPCKV.Text = "";
            txt_HSPCDT.Text = "";
            txt_SoBHXH.Text = "1234567890123";
            dat_NgayBatDauDong.SelectedDate = new DateTime(1978, 9, 1, 0, 0, 0);
            txt_SoThangDaDong.Text = "";

        }

      #region =

        protected override void OnPreInit(EventArgs e)
        {
            AllowSkinOverride = true;
            base.OnPreInit(e);
            Load += Page_Load;
        }

        protected override void OnInit(EventArgs e)
        {
            LoadParams();
            LoadPanels();
            base.OnInit(e);
            SuppressPageMenu();
        }
      
        private void LoadParams()
        {
            pageId = WebUtils.ParseInt32FromQueryString("pageid", pageId);
            moduleId = WebUtils.ParseInt32FromQueryString("mid", true, moduleId);
            id = WebUtils.ParseStringFromQueryString("id", id);
            cacheDependencyKey = "Module-" + moduleId.ToInvariantString();
        }

        private void LoadPanels()
        {
            bool showLeftColumnAdmin = ConfigHelper.GetBoolProperty("ShowLeftColumnAdmin", false);
            bool showRightColumnAdmin = ConfigHelper.GetBoolProperty("ShowRightColumnAdmin", false);
            bool showTopColumnAdmin = ConfigHelper.GetBoolProperty("ShowTopColumnAdmin", false);
            bool showBottomColumnAdmin = ConfigHelper.GetBoolProperty("ShowBottomColumnAdmin", false);
            int showCenterColumnAdmin = ConfigHelper.GetIntProperty("ShowCenterColumnAdmin", 0);
            LoadSideContent(showLeftColumnAdmin, showRightColumnAdmin, showTopColumnAdmin, showBottomColumnAdmin, showCenterColumnAdmin);
        }
        #endregion
    }
    public class MemberFull
    {
        public string Ten { get; set; }
        public string GioiTinh { get; set; }
        public string NgaySinh { get; set; }
        public string TTHN { get; set; }
        public string CMND { get; set; }
        public string NoiCap { get; set; }
        public string NgayCap { get; set; }
        public string NoiSinh { get; set; }
        public string XaPhuong { get; set; }
        public string QuanHuyen { get; set; }
        public string TinhTP { get; set; }
        public string HKTT { get; set; }
        public string NoiOHN { get; set; }
        public string DienThoai { get; set; }
        public string Email { get; set; }
        public string DanToc { get; set; }
        public string TonGiao { get; set; }
        public string TPXT { get; set; }
        public string GDUT{ get; set; }
        public string NgayHD { get; set; }
        public string NgayTD { get; set; }
        public string CQTN { get; set; }
        public string CongViecDG { get; set; }
        public string NgayVeCQ { get; set; }
        public string ThuocLoaiCB { get; set; }
        public string CongViecHN { get; set; }
        public string DangNghiBHXH { get; set; }
        public string NgayVaoNganhGD { get; set; }
        public string ChucVuHT { get; set; }
        public string HSPCCV { get; set; }
        public string NgayBNCVHT { get; set; }
        public string ChucVuCQKN { get; set; }
        public string ChucVuCQCN { get; set; }
        public string NgayVaoDang { get; set; }
        public string NgayChinhThuc { get; set; }
        public string ChucVuDangHT { get; set; }
        public string LaDoanVien { get; set; }
        public string ChucVuDoanTheHN { get; set; }
        public string DangTheoHoc { get; set; }
        public string UTBanThan { get; set; }
        public string HocVan { get; set; }
        public string TrinhDoCMCN { get; set; }
        public string ChuyenNganhDT { get; set; }
        public string NoiDT { get; set; }
        public string HinhThucDT { get; set; }
        public string NamTN { get; set; }
        public string TDLLCT { get; set; }
        public string TDQLNN { get; set; }
        public string TDLLCTT { get; set; }
        public string TDTH { get; set; }
        public string NgoaiNguThanhThao { get; set; }
        public string NgoaiNguKhac { get; set; }
        public string ChucDanh { get; set; }
        public string NamCN { get; set; }
        public string DanhHieuCN{ get; set; }
        public string NgachCC{ get; set; }
        public string BacLuong { get; set; }
        public string HSLuong { get; set; }
        public string HuongTuNgay { get; set; }
        public string MocLuongLS { get; set; }
        public string PCUD { get; set; }
        public string PCTrachNhiem { get; set; }
        public string PCThuHut { get; set; }
        public string PCDocHai { get; set; }
        public string PCKhuVuc { get; set; }
        public string PCDacThu { get; set; }
        public string PCKhac { get; set; }
        public string PCVuotKhung { get; set; }
        public string SoBHXH { get; set; }
        public string NgayDongBHXH { get; set; }
        public string SoThangDaDong { get; set; }

        public MemberFull(string ten, string gioitinh, string ngaysinh, string tthn, string cmnd, string noicap, string ngaycap
           , string noisinh, string xaphuong, string quanhuyen, string tinhthanhpho, string hktt, string noiohn, string dienthoai
            , string email, string dantoc, string tongiao, string tpxt, string gdut, string ngayhd, string ngaytd, string cqtn
            , string cvdg, string ngayvecq, string thuocloaicb, string cvhn, string dangnghibhxh, string ngayvaonganhgd, string cvht
            , string hspccv, string ngaybncvht, string chucvucqkn, string chucvucqcn, string ngayvaodang, string ngayct, string cvdanght
            , string ladoanvien, string cvdoanthehn, string dangtheohoc, string utbanthan, string hocvan, string trinhdocmcn
            , string chuyennganhdt, string noidt, string hinhthucdt, string namtn, string tdllct, string tdqlnn, string tdllctt
            , string tdth, string ngoaingutt, string ngoaingukhac, string chucdanh, string namcn, string danhhieucn, string ngachcc
            , string bacluong, string hsluong, string huongtungay, string mocluongls, string pcud, string pctrachnhiem
            , string pcthuhut, string pcdochai, string pckhuvuc, string pcdacthu, string pckhac, string pcvuotkhung, string SoBHXH
            , string ngaydongbhxh, string SoThangDaDong)
        {
            this.Ten = ten;
            this.GioiTinh = gioitinh;
            this.NgaySinh = ngaysinh;
            this.TTHN = tthn;
            this.CMND = cmnd;
            this.NoiCap = noicap;
            this.NgayCap = ngaycap;
            this.NoiSinh = noisinh;
            this.XaPhuong = xaphuong;
            this.QuanHuyen = quanhuyen;
            this.TinhTP = tinhthanhpho;
            this.HKTT = hktt;
            this.NoiOHN = noiohn;
            this.DienThoai = dienthoai;
            this.Email = email;
            this.DanToc = dantoc;
            this.TonGiao = tongiao;
            this.TPXT = tpxt;
            this.GDUT = gdut;
            this.NgayHD = ngayhd;
            this.NgayTD = ngaytd;
            this.CQTN = cqtn;
            this.CongViecDG = cvdg;
            this.NgayVeCQ = ngayvecq;
            this.ThuocLoaiCB = thuocloaicb;
            this.CongViecHN = cvhn;
            this.DangNghiBHXH = dangnghibhxh;
            this.NgayVaoNganhGD = ngayvaonganhgd;
            this.ChucVuHT = cvht;
            this.HSPCCV = hspccv;
            this.NgayBNCVHT = ngaybncvht;
            this.ChucVuCQKN = chucvucqkn;
            this.ChucVuCQCN = chucvucqcn;
            this.NgayVaoDang = ngayvaodang;
            this.NgayChinhThuc = ngayct;
            this.ChucVuDangHT = cvdanght;
            this.LaDoanVien = ladoanvien;
            this.ChucVuDoanTheHN = cvdoanthehn;
            this.DangTheoHoc=dangtheohoc;
            this.UTBanThan = utbanthan;
            this.HocVan = hocvan;
            this.TrinhDoCMCN = trinhdocmcn;
            this.ChuyenNganhDT = chuyennganhdt;
            this.NoiDT = noidt;
            this.HinhThucDT = hinhthucdt;
            this.NamTN = namtn;
            this.TDLLCT = tdllct;
            this.TDQLNN = tdqlnn;
            this.TDLLCTT = tdllctt;
            this.TDTH = tdth;
            this.NgoaiNguThanhThao = ngoaingutt;
            this.NgoaiNguKhac = ngoaingukhac;
            this.ChucDanh = chucdanh;
            this.NamCN = namcn;
            this.DanhHieuCN = danhhieucn;
            this.NgachCC = ngachcc;
            this.BacLuong = bacluong;
            this.HSLuong = hsluong;
            this.HuongTuNgay = huongtungay;
            this.MocLuongLS = mocluongls;
            this.PCUD = pcud;
            this.PCTrachNhiem = pctrachnhiem;
            this.PCThuHut = pcthuhut;
            this.PCDocHai = pcdochai;
            this.PCKhuVuc = pckhuvuc;
            this.PCDacThu = pcdacthu;
            this.PCKhac = pckhac;
            this.PCVuotKhung = pcvuotkhung;
            this.SoBHXH = SoBHXH;
            this.NgayDongBHXH = ngaydongbhxh;
            this.SoThangDaDong = SoThangDaDong;
        }
    }
}
